{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-05-10T04:26:46.360749Z",
     "start_time": "2025-05-10T04:26:41.615807Z"
    }
   },
   "outputs": [],
   "source": [
    "from selenium import webdriver\n",
    "from selenium.webdriver.common.by import By\n",
    "\n",
    "driver = webdriver.Edge()\n",
    "driver.get(\"https://www.iviewui.com/view-ui-plus/component/form/checkbox\")\n",
    "\n",
    "driver.maximize_window() # 页面最大化\n",
    "\n",
    "driver.find_element(By.XPATH,'//span[text()=\"香蕉\"]').click()\n",
    "driver.find_element(By.XPATH,'//span[text()=\"苹果\"]').click()\n",
    "driver.find_element(By.XPATH,'//span[text()=\"西瓜\"]').click()\n",
    "\n",
    "# # 同级选择器\n",
    "# driver.find_element(By.XPATH,'//span[text()=香蕉]/preceding-sibling::span/input').click()"
   ]
  },
  {
   "cell_type": "code",
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "693c99c6acae30cb"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
